package com.shungen.apicloud.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shungen.apicloud.mapper.PointTransactionMapper;
import com.shungen.apicloud.model.entity.PointTransaction;
import com.shungen.apicloud.model.vo.PointTransactionVO;
import com.shungen.apicloud.service.PointTransactionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 积分变动服务实现
 *
 */
@Service
@Slf4j
public class PointTransactionServiceImpl extends ServiceImpl<PointTransactionMapper, PointTransaction> implements PointTransactionService {

    @Override
    public Page<PointTransaction> getPageDataByUserId(Long userId,Integer current,Integer pageSize) {
        Page<PointTransaction> page = new Page<>(current,pageSize);
        LambdaQueryWrapper<PointTransaction> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(PointTransaction::getUserId,userId);
        Page<PointTransaction> pointTransactionPage = this.baseMapper.selectPage(page, queryWrapper);
        return pointTransactionPage;
    }
}
